# 添加并更新Helm仓库
helm repo add gitea https://dl.gitea.com/charts
helm repo update

# 导出配置文件与说明文件
helm show values gitea/gitea > values.yaml
helm show readme gitea/gitea > README.md

# 为开发环境修改gitea配置文件 values.yaml
#redis-cluster:
#  enabled: false
#postgresql:
#  enabled: false
#postgresql-ha:
#  enabled: false

#ingress:
#  enabled: true

#persistence:
#  enabled: true
#  claimName: gitea-shared-storage
#  size: 5Gi
#  storageClass:

#gitea:
#  config:
#    database:
#      DB_TYPE: sqlite3
#    session:
#      PROVIDER: memory
#    cache:
#      ADAPTER: memory
#    queue:
#      TYPE: level
#admin:
#  username: admin
#  password: admin123456
#http:
#  type: NodePort
#  port: 3000
#  nodePoart: 3000

# 使用自定义的配置文件安装gitea
helm install gitea -f values.yaml gitea/gitea

# 卸载gitea
# helm uninstall gitea
# 清理gitea的持久卷
# kubectl get pvc gitea-shared-storage
# kubectl delete pvc gitea-shared-storage

# 查看gitea在k3s上的部署情况
kubectl get all,pv,pvc,ing

# 获取GITEA_INSTANCE_URL
# 获取GITEA_RUNNER_REGISTRATION_TOKEN
# 部署act_runner
kubectl apply -f gitea_act_runner_rootless.yaml

# 清理Evicted状态的pod(磁盘压力,内存压力等)
kubectl delete pod act-runner-xxxx
